package Task1;

import java.util.ArrayList;
import java.util.Iterator;

public class EmailAdder implements Runnable {
	private Queue queue1;
	private ArrayList<Email> emailList;

	public EmailAdder(Queue queue1, ArrayList<Email> al) {
		this.queue1 = queue1;
		this.emailList = al;
	}

	public void run() {
		Iterator<Email> iter = emailList.iterator();
		while (iter.hasNext()) {
			queue1.addEmail(iter.next());
		}
		EmailSender.setFlag();
	}
}
